package user

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/marmotedu/go-admin/internal/app/bo"
	"net/http"
)

// 接口对象参数
type UserBO struct {
	bo.BaseBo
	UserId   uint64 `json:"userId"`
	UserName string `json:"userName"`
	Password string `json:"password"`
}

// 注册路由
func RegisterUserRoutes(r *gin.RouterGroup) {
	// 注册模块分组
	userAPI := r.Group("/user")
	// 注册模块的所有相关路由
	{
		userAPI.POST("/login", login)
		userAPI.GET("/queryUserPage", queryUserPage)
		userAPI.GET("/addUser", addUser)
		userAPI.GET("/delUser", delUser)
		userAPI.GET("/updateUser", updateUser)
	}

}
func login(c *gin.Context) {
	var userBO UserBO

	if err := c.ShouldBindJSON(&userBO); err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code": 1,
			"msg":  "参数错误",
		})
		return
	}
	fmt.Print("login")
	c.String(http.StatusOK, "Hello, World!")

}
func queryUserPage(c *gin.Context) {
	fmt.Print("queryUserPage")
	c.String(http.StatusOK, "Hello, World!")
}
func addUser(c *gin.Context) {
	fmt.Print("addUser")

}

func delUser(c *gin.Context) {
	fmt.Print("delUser")

}
func updateUser(c *gin.Context) {
	fmt.Print("updateUser")

}
